package br.com.post.interceptor;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class LoginInterceptor implements Interceptor{
	
	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		if(request.getSession().getAttribute("USER") != null)
			return invocation.invoke();
		return "restrict";
	}
	
	@Override
	public void destroy() {
		// TODO 
	}

	@Override
	public void init() {
		// TODO 
	}
}
